A 4-component vector class, with floats.
More...
A 4-component vector class, with floats.
◆ Vector() [1/7]
nkMaths::Vector::Vector |
( |
| ) |
|
◆ Vector() [2/7]
nkMaths::Vector::Vector |
( |
float |
x, |
|
|
float |
y |
|
) |
| |
2D constructor.
- Parameters
-
x | The x component to assign. |
y | The y component to assign. |
◆ Vector() [3/7]
nkMaths::Vector::Vector |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
| |
3D constructor.
- Parameters
-
x | The x component to assign. |
y | The y component to assign. |
z | The z component to assign. |
◆ Vector() [4/7]
nkMaths::Vector::Vector |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z, |
|
|
float |
w |
|
) |
| |
4D constructor.
- Parameters
-
x | The x component to assign. |
y | The y component to assign. |
z | The z component to assign. |
w | The w component to assign. |
◆ Vector() [5/7]
nkMaths::Vector::Vector |
( |
const Vector & |
other | ) |
|
Copy constructor.
- Parameters
-
other | The vector to copy from. |
◆ Vector() [6/7]
nkMaths::Vector::Vector |
( |
const IVector & |
other | ) |
|
Copy constructor.
- Parameters
-
other | The vector to copy from. |
◆ Vector() [7/7]
nkMaths::Vector::Vector |
( |
const DirectX::XMVECTOR & |
value | ) |
|
Fill constructor.
- Parameters
-
◆ ~Vector()
nkMaths::Vector::~Vector |
( |
| ) |
|
◆ getX()
float nkMaths::Vector::getX |
( |
| ) |
const |
◆ getY()
float nkMaths::Vector::getY |
( |
| ) |
const |
◆ getZ()
float nkMaths::Vector::getZ |
( |
| ) |
const |
◆ getW()
float nkMaths::Vector::getW |
( |
| ) |
const |
◆ getValues()
DirectX::XMVECTOR nkMaths::Vector::getValues |
( |
| ) |
const |
- Returns
- The values compressed in the DirectXMath structure.
◆ setX()
void nkMaths::Vector::setX |
( |
float |
value | ) |
|
Sets the x component.
- Parameters
-
◆ setY()
void nkMaths::Vector::setY |
( |
float |
value | ) |
|
Sets the y component.
- Parameters
-
◆ setZ()
void nkMaths::Vector::setZ |
( |
float |
value | ) |
|
Sets the z component.
- Parameters
-
◆ setW()
void nkMaths::Vector::setW |
( |
float |
value | ) |
|
Sets the w component.
- Parameters
-
◆ addX()
void nkMaths::Vector::addX |
( |
float |
value | ) |
|
Adds to the x component.
- Parameters
-
◆ addY()
void nkMaths::Vector::addY |
( |
float |
value | ) |
|
Adds to the y component.
- Parameters
-
◆ addZ()
void nkMaths::Vector::addZ |
( |
float |
value | ) |
|
Adds to the z component.
- Parameters
-
◆ addW()
void nkMaths::Vector::addW |
( |
float |
value | ) |
|
Adds to the w component.
- Parameters
-
◆ multX()
void nkMaths::Vector::multX |
( |
float |
value | ) |
|
Multiply the x component.
- Parameters
-
value | The value to multiply. |
◆ multY()
void nkMaths::Vector::multY |
( |
float |
value | ) |
|
Multiply the y component.
- Parameters
-
value | The value to multiply. |
◆ multZ()
void nkMaths::Vector::multZ |
( |
float |
value | ) |
|
Multiply the z component.
- Parameters
-
value | The value to multiply. |
◆ multW()
void nkMaths::Vector::multW |
( |
float |
value | ) |
|
Multiply the w component.
- Parameters
-
value | The value to multiply. |
◆ normalizeAsVec2()
void nkMaths::Vector::normalizeAsVec2 |
( |
| ) |
|
Normalizes the vector, interpreting it as a 2D vector.
◆ getNormalizedAsVec2()
Vector nkMaths::Vector::getNormalizedAsVec2 |
( |
| ) |
const |
- Returns
- A vector corresponding to this vector interpreted as a 2D vector and normalized.
◆ normalizeAsVec3()
void nkMaths::Vector::normalizeAsVec3 |
( |
| ) |
|
Normalizes the vector, interpreting it as a 3D vector.
◆ getNormalizedAsVec3()
Vector nkMaths::Vector::getNormalizedAsVec3 |
( |
| ) |
const |
- Returns
- A vector corresponding to this vector interpreted as a 3D vector and normalized.
◆ normalizeAsVec4()
void nkMaths::Vector::normalizeAsVec4 |
( |
| ) |
|
Normalizes the vector, interpreting it as a 4D vector.
◆ getNormalizedAsVec4()
Vector nkMaths::Vector::getNormalizedAsVec4 |
( |
| ) |
const |
- Returns
- A vector corresponding to this vector interpreted as a 4D vector and normalized.
◆ dotProductAsVec2()
float nkMaths::Vector::dotProductAsVec2 |
( |
const Vector & |
other | ) |
const |
Computes the dot product, interpreting both vectors as 2D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting dot product computed.
◆ dotProductAsVec3()
float nkMaths::Vector::dotProductAsVec3 |
( |
const Vector & |
other | ) |
const |
Computes the dot product, interpreting both vectors as 3D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting dot product computed.
◆ dotProductAsVec4()
float nkMaths::Vector::dotProductAsVec4 |
( |
const Vector & |
other | ) |
const |
Computes the dot product, interpreting both vectors as 4D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting dot product computed.
◆ setAsCrossVec2()
void nkMaths::Vector::setAsCrossVec2 |
( |
const Vector & |
other | ) |
|
Computes and sets in place the cross product, interpreting both vectors as 2D vectors.
- Parameters
-
other | The vector to compute the product with. |
◆ getCrossVec2()
Vector nkMaths::Vector::getCrossVec2 |
( |
const Vector & |
other | ) |
|
Computes the cross product, interpreting both vectors as 2D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting cross product computed.
◆ setAsCrossVec3()
void nkMaths::Vector::setAsCrossVec3 |
( |
const Vector & |
other | ) |
|
Computes and sets in place the cross product, interpreting both vectors as 3D vectors.
- Parameters
-
other | The vector to compute the product with. |
◆ getCrossVec3()
Vector nkMaths::Vector::getCrossVec3 |
( |
const Vector & |
other | ) |
const |
Computes the cross product, interpreting both vectors as 3D vectors.
- Parameters
-
other | The vector to compute the product with. |
- Returns
- The resulting cross product computed.
◆ setAsCrossVec4()
void nkMaths::Vector::setAsCrossVec4 |
( |
const Vector & |
other1, |
|
|
const Vector & |
other2 |
|
) |
| |
Computes and sets in place the cross product, interpreting all vectors as 4D vectors.
- Parameters
-
other1 | The vector to compute the product with. |
other2 | The vector to compute the product with. |
◆ getCrossVec4()
Vector nkMaths::Vector::getCrossVec4 |
( |
const Vector & |
other1, |
|
|
const Vector & |
other2 |
|
) |
| const |
Computes the cross product, interpreting all vectors as 4D vectors.
- Parameters
-
other1 | The vector to compute the product with. |
other2 | The vector to compute the product with. |
- Returns
- The resulting cross product computed.
◆ getLength()
float nkMaths::Vector::getLength |
( |
| ) |
const |
- Returns
- The length of the vector.
◆ getLengthSquared()
float nkMaths::Vector::getLengthSquared |
( |
| ) |
const |
- Returns
- The length of the vector, quared. For simple comparisons, if possible, prefer this function as it is more performant.
◆ getDistanceSquared()
float nkMaths::Vector::getDistanceSquared |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The distance between both vectors, squared. Prefer to use this function when possible as it is more performant.
◆ getDistance()
float nkMaths::Vector::getDistance |
( |
const Vector & |
other | ) |
const |
- Parameters
-
other | The vector to check the distance with. |
- Returns
- The distance between both vectors.
◆ fromString()
void nkMaths::Vector::fromString |
( |
const std::string_view & |
str | ) |
|
Parse components from a string. Format is "x,y,z,w".
- Parameters
-
◆ operator=() [1/2]
Assignment operator.
- Parameters
-
other | The vector to overwrite from. |
- Returns
- The calling vector, updated.
◆ operator=() [2/2]
Assignment operator.
- Parameters
-
other | The vector to overwrite from. |
- Returns
- The calling vector, updated.
◆ operator+()
Vector nkMaths::Vector::operator+ |
( |
const Vector & |
other | ) |
const |
Addition operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator+=()
void nkMaths::Vector::operator+= |
( |
const Vector & |
other | ) |
|
Addition and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator-()
Vector nkMaths::Vector::operator- |
( |
const Vector & |
other | ) |
const |
Subtraction operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator-=()
void nkMaths::Vector::operator-= |
( |
const Vector & |
other | ) |
|
Subtraction and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator*() [1/4]
Vector nkMaths::Vector::operator* |
( |
const Vector & |
other | ) |
const |
Multiplication operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator*=() [1/4]
void nkMaths::Vector::operator*= |
( |
const Vector & |
other | ) |
|
Multiplication and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator*() [2/4]
Multiplication operator.
- Parameters
-
other | The quaternion to operate with. |
- Returns
- A result vector, after transformation.
◆ operator*=() [2/4]
void nkMaths::Vector::operator*= |
( |
const Quaternion & |
other | ) |
|
Multiplication and assignment operator.
- Parameters
-
other | The quaternion to operate with. |
◆ operator*() [3/4]
Vector nkMaths::Vector::operator* |
( |
const Matrix & |
mat | ) |
const |
Multiplication operator.
- Parameters
-
mat | The matrix to operate with. |
- Returns
- A result vector, after transformation.
◆ operator*=() [3/4]
void nkMaths::Vector::operator*= |
( |
const Matrix & |
other | ) |
|
Multiplication and assignment operator.
- Parameters
-
other | The matrix to operate with. |
◆ operator*() [4/4]
Vector nkMaths::Vector::operator* |
( |
float |
coeff | ) |
const |
Multiplication operator.
- Parameters
-
coeff | The scalar to operate with. |
- Returns
- A result vector, after operation application on all components.
◆ operator*=() [4/4]
void nkMaths::Vector::operator*= |
( |
float |
coeff | ) |
|
Multiplication and assignment operator.
- Parameters
-
coeff | The scalar to operate with. |
◆ operator/() [1/2]
Vector nkMaths::Vector::operator/ |
( |
const Vector & |
other | ) |
const |
Division operator.
- Parameters
-
other | The vector to operate with. |
- Returns
- A result vector, after operation application.
◆ operator/=() [1/2]
void nkMaths::Vector::operator/= |
( |
const Vector & |
other | ) |
|
Division and assignment operator.
- Parameters
-
other | The vector to operate with. |
◆ operator/() [2/2]
Vector nkMaths::Vector::operator/ |
( |
float |
coeff | ) |
const |
Division operator.
- Parameters
-
coeff | The scalar to operate with. |
- Returns
- A result vector, after operation application on all components.
◆ operator/=() [2/2]
void nkMaths::Vector::operator/= |
( |
float |
coeff | ) |
|
Division and assignment operator.
- Parameters
-
coeff | The scalar to operate with. |
◆ operator==()
bool nkMaths::Vector::operator== |
( |
const Vector & |
other | ) |
const |
Equality operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the vectors are equal (true) or not (false).
◆ operator!=()
bool nkMaths::Vector::operator!= |
( |
const Vector & |
other | ) |
const |
Difference operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the vectors are different (true) or not (false).
◆ operator<()
bool nkMaths::Vector::operator< |
( |
const Vector & |
other | ) |
const |
Less than operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is smaller (true) or not (false).
◆ operator<=()
bool nkMaths::Vector::operator<= |
( |
const Vector & |
other | ) |
const |
Less than or equal operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is smaller, equal (true) or not (false).
◆ operator>()
bool nkMaths::Vector::operator> |
( |
const Vector & |
other | ) |
const |
Greater than operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is greater (true) or not (false).
◆ operator>=()
bool nkMaths::Vector::operator>= |
( |
const Vector & |
other | ) |
const |
Greater than or equal operator.
- Parameters
-
other | The vector to check against. |
- Returns
- If the calling vector is greater, equal (true) or not (false).
The documentation for this class was generated from the following file:
- Documentation/Headers/NilkinsMaths/Algebra/Vector.h